package com.zhongfl.crm.lixiao.bean.resolve;

import com.heptagram.lixiao.bean.response.LXUserResponse;
import com.zhongfl.crm.model.LxUser;

import java.util.Objects;

/**
 * @author wang.yuchuan
 * @date 2018/6/24
 */
public class UserModelResolver implements ModelResolver<LxUser, LXUserResponse.User> {
    @Override
    public LxUser resolve(LXUserResponse.User obj) {
        if(Objects.isNull(obj)){
            return null;
        }

        LxUser lxUser = new LxUser();
        lxUser.setName(obj.getName());
        lxUser.setModifiedBy("System");
        lxUser.setCreatedBy("System");
        lxUser.setAvatarUrl(obj.getAvatarUrl());
        lxUser.setDepartmentId(obj.getDepartmentId());
        lxUser.setDepartmentName(obj.getDepartmentName());
        lxUser.setGender(obj.getGender());
        lxUser.setLxId(obj.getId());
        lxUser.setRole(obj.getRole());

        return lxUser;
    }
}
